package ReSofting.it.GoldDirector.Helpers;

import ReSofting.it.GoldDirector.Interfaces.IInputBoxDelegate;
import android.app.AlertDialog;
import android.app.Application;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.Editable;
import android.text.GetChars;
import android.widget.EditText;

public class InputBox {
	
	 static EditText inputt = null;
		
	static AlertDialog.Builder alert = null ;
	
	IInputBoxDelegate<Editable> listener;
	
  public InputBox(IInputBoxDelegate<Editable> listener) {
        this.listener = listener;
    }
	
	
	public void showInputBox(String pTitle, String pMessage,String pDefault, Context pContext, final String pToken)
	{
		AlertDialog.Builder alert = new AlertDialog.Builder(pContext);
				
		inputt = new EditText(pContext);
		inputt.setText(pDefault);
		
		
		alert.setTitle(pTitle)
	    .setMessage(pMessage)
	    .setView(inputt)
	    .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
	        public void onClick(DialogInterface dialog, int whichButton) {
	            Editable value = inputt.getText(); 
	            listener.onInputCallComplete(value,pToken);
	        }
	    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
	        public void onClick(DialogInterface dialog, int whichButton) {
	        	listener.onInputCallComplete(null,pToken);
	            //notify;
	        }
	    });
				
		alert.show();
	    //.show();
				 
	
	}//fM

}//fC
